//
//  AppDelegate.swift
//  WiFiFaster
//
//  Created by one on 2023/12/28.
//

import UIKit

@main
class WATFAppDelegate: UIResponder, UIApplicationDelegate {
    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        watf_window?.backgroundColor = .white
        watf_window?.rootViewController = WATFLaunchViewController()
        watf_window?.makeKeyAndVisible()
        return true
    }
    
    //MARK: - watf action
    func watf_refreshMainVC() {
        WATFManager.watf_manager.watf_LaunchH = true
        watf_window?.rootViewController = WATFNavViewController(rootViewController: WATFHomeViewController())
        watf_window?.makeKeyAndVisible()
    }
    func applicationDidReceiveMemoryWarning(_ application: UIApplication) {
        
    }
    func applicationWillTerminate(_ application: UIApplication) {
        WATFManager.watf_manager.watf_ftvManager?.connection.stopVPNTunnel()
        WATFManager.watf_manager.watf_stopConnect()
    }
    //MARK: - watf lazy
    @objc lazy var watf_window: UIWindow? = {
        return UIWindow(frame: UIScreen.main.bounds)
    }()
    
    @objc class func watf_shared() -> WATFAppDelegate {
        return UIApplication.shared.delegate as! WATFAppDelegate
    }
}

